const { Controller } = require('varal');
const { sequelize } = require('../../models');

class JournalController extends Controller {
	async index(app) {
		const { page = 1, page_size = 1000 } = this.app.fields;
		const { id: user_id } = app.auth;

		const serv = this.app.service('JournalService');
		return serv.get({
			user_id
		}, page, page_size).then(({ data, total }) => {
			this.app.json({
				err_code: 0,
				data: {
					data,
					total
				}
			});
		})
	}

}

exports = module.exports = JournalController;
